
import java.math.BigDecimal;
import org.gruposp2p.aularest.model.Itemcalificable;
import org.gruposp2p.aularest.model.Score;
import org.gruposp2p.aularest.model.Student;
import org.gruposp2p.aularest.service.AulaDataService;
import org.gruposp2p.aularest.service.AulaDataServiceImpl;

/**
 *
 * @author jj
 */
public class InsertScore {

    public static void main (String[] args) throws Exception {

    }

    public void insertItemcalificableScore () throws Exception {
        Score score = new Score();
        score.setValue(BigDecimal.valueOf(2));
        AulaDataService dataService = new AulaDataServiceImpl();
        Student student =
                dataService.findStudent(new Integer(201));
        score.setStudentId(student);
        Itemcalificable itemcalificable = dataService.findItemcalificable(
                new Integer(1));
        score.setItemcalificableId(itemcalificable);
        dataService.createScore(score);
    }

    public void insertScore () throws Exception {
        Score score = new Score();
        score.setValue(BigDecimal.ZERO);
        AulaDataService dataService = new AulaDataServiceImpl();
        Student student =
                dataService.findStudent(new Integer(201));
        score.setStudentId(student);
        Itemcalificable itemcalificable = dataService.findItemcalificable(
                new Integer(1));
        score.setItemcalificableId(itemcalificable);
        dataService.createScore(score);
    }

}
